home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-01 | 541 b | 24 lines | [TEXT/CWIE] |
- //
- // StQ3Disposer.h
- //
- // by James Jennings
- //
- // A clever little utility for automatically disposing of QD3D objects.
- // Note that we can either attach the TQ3Object in the constructor,
- // or with operator=().
-
- #pragma once
- #include <QD3D.h>
-
- class StQ3Disposer {
- public:
- StQ3Disposer(TQ3Object obj = 0) : theObject(obj)
- {}
- ~StQ3Disposer(void)
- { if (theObject) ::Q3Object_Dispose(theObject); }
- StQ3Disposer & operator=(TQ3Object obj)
- { Assert_(theObject==nil); theObject = obj; return *this; }
- private:
- TQ3Object theObject;
- };
-